import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JPanel;

/*
 * ClockGUI.java : This class gets cities from user and sends them to Clock class. 
 * 				This class has an instance of ClockGUI class.
 *
 * @Author : BilCIS
 */

public class ClockGUI extends JPanel
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 4750707373848591323L;

	// Variables
	private	String[] locationBag = { "Ankara", "New York", "Tokyo", "London", "Moscow" };
	
	private	JComboBox<String> locationBox;
	
	private Clock 	c;
	
	private JPanel contentPane;
	
	private Employee emp;
	// Variables ending
	
	public ClockGUI( Employee emp)
	{	
		this.emp = emp;
		create();
		this.setVisible(true);
	}
	
	private void create()
	{
		//
		//	Creates the components
		//
		contentPane = new JPanel(null);
		c = new Clock(emp);
		locationBox = new JComboBox<String>(locationBag);
		//
		//	Register Listeners
		//
		locationBox.addActionListener(new locationBox_Action());
		//
		//	Setbounds
		//
		contentPane.setBounds(0,0,500,500);
		c.setBounds(0, 50, 320, 320);
		locationBox.setBounds(100,0,130,40);
		//
		//	Adds to pane
		//
		this.add(contentPane);
		contentPane.add(c);
		contentPane.add(locationBox);
		
		//********************** Colors *********************//
		contentPane.setBackground(emp.getColor());
		
		//
		//	ClockGUI
		//
		this.setSize(new Dimension(500, 500));
		this.setLayout(null);
	}
	
	// ComboBox Listener
	public class locationBox_Action implements ActionListener
	{
		public void actionPerformed (ActionEvent e)
		{
        	c.setLocation( locationBox.getSelectedItem().toString() );
		}
	}
}
